local sangu = fk.CreateSkill {
  name = "rmt__sangu",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["rmt__sangu"] = "三顾",
  [":rmt__sangu"] = "锁定技，每当有三张牌指定你为目标后，你获得3点<a href='rmt_moulue'>谋略值</a>，然后你观看牌堆顶的三张牌并将这些牌置于牌堆顶或牌堆底。",

  ["rmt_moulue"] = "<b>谋略值：</b><br>谋略值上限为5，有谋略值的角色拥有技能<a href=':rmt__miaoji'>〖妙计〗</a>。",

  ["@rmt__sangu"] = "三顾",

  ["$rmt__sangu1"] = "大梦先觉，感三顾之诚，布天下三分。",
  ["$rmt__sangu2"] = "卧龙初晓，铭鱼水之情，托死生之志。",
}

local RUtil = require ("packages.aaa_Romantic.utility.rmt_util")

sangu:addEffect(fk.TargetConfirmed, {
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    return
      target == player and
      player:hasSkill(sangu.name) and
      player:getMark("@rmt__sangu") > 0 and
      player:getMark("@rmt__sangu") % 3 == 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player, "@rmt__sangu", 0)
    if player:getMark("@rmt_moulue") < 5 then
      RUtil.handleMoulue(room, player, 3)
    end
    room:askToGuanxing(player, { cards = room:getNCards(3), skill_name = sangu.name })
  end,

  can_refresh = function(self, event, target, player, data)
    return target == player and player:hasSkill(sangu.name)
  end,
  on_refresh = function(self, event, target, player, data)
    player.room:addPlayerMark(player, "@rmt__sangu")
  end
})

return sangu
